package com.dsj.gxrd.modules.activity.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dsj.gxrd.modules.activity.domain.entity.RdPlanManagement;
import com.dsj.gxrd.modules.activity.domain.query.RdPlanManagementQuery;
import com.dsj.gxrd.modules.activity.mapper.RdPlanManagementMapper;
import com.dsj.gxrd.modules.activity.service.RdPlanManagementService;
import com.dsj.gxrd.utils.BaseEntityHandlerUtils;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.security.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * @author songpin566
 * @date 2023/10/07
 **/
@Service
public class RdPlanManagementServiceImpl extends ServiceImpl<RdPlanManagementMapper, RdPlanManagement> implements RdPlanManagementService {

    @Autowired
    private RdPlanManagementMapper rdPlanManagementMapper;

    @Override
    public List<RdPlanManagement> selectPlanManagementList(RdPlanManagementQuery rdPlanManagement) {
        return rdPlanManagementMapper.selectPlanManagementList(rdPlanManagement);
    }

    @Override
    public boolean insertPlanManagement(RdPlanManagement rdPlanManagement) {
        BaseEntityHandlerUtils.fastSetBaseEntity(rdPlanManagement, SecurityUtils.getLoginUser(), false);
        rdPlanManagement.setDelFlag(0);
        return save(rdPlanManagement);
    }

    @Override
    public boolean updatePlanManagement(RdPlanManagement rdPlanManagement) {
        BaseEntityHandlerUtils.fastSetBaseEntity(rdPlanManagement, SecurityUtils.getLoginUser(),true);
        return updateById(rdPlanManagement);
    }

    @Override
    public AjaxResult removes(List<Long> ids) {
        return this.removeBatchByIds(ids) ? AjaxResult.success("删除成功!") : AjaxResult.error();
    }


}
